import * as THREE from 'three';
// import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
// const loader = new GLTFLoader();
const model  =  new THREE.Group();
// const texLoader = new THREE.TextureLoader();
// // 加载贴图
// const texture = texLoader.load('./黑色.png');

// loader.load('/glb/big.glb', function (gltf) { 
//     // console.log('gltf.scene',gltf.scene);
//     console.log(gltf,'gltf');
    
//     const nameNode = gltf.scene.getObjectByName("平面");
//     nameNode.material.color.set(0xff0000);//改变1号楼Mesh材质颜色
//     model.add(gltf.scene); 
   
    
// })


const geometry = new THREE.PlaneGeometry(1468, 400);
//纹理贴图加载器TextureLoader
const texLoader = new THREE.TextureLoader();
// .load()方法加载图像，返回一个纹理对象Texture
// const texture = texLoader.load('./指南针.png');
const bg_png = require("@/views/THREE/12.2.png")
const texture = texLoader.load(bg_png);
const material = new THREE.MeshLambertMaterial({
    map: texture,//map表示材质的颜色贴图属性
    transparent:true,//开启透明，这样png贴图的透明部分不显示
});

 //场地
const GeoB1 = new THREE.PlaneGeometry(120, 80);

const GeoB2 = new THREE.PlaneGeometry(120, 100);

const GeoB3 = new THREE.PlaneGeometry(120, 120);

const GeoB4 = new THREE.PlaneGeometry(100, 120);

const matB1 = new THREE.MeshLambertMaterial({
    color: '#fff',//map表示材质的颜色贴图属性
});

const meshB1 =  new THREE.Mesh(GeoB1, matB1.clone());
meshB1.position.set(550, 330, 0);
meshB1.name = '评标12'

const meshB2 =  new THREE.Mesh(GeoB2,  matB1.clone())
meshB2.position.set(430, 204, 0);
meshB2.name = '定标1'

const meshB3 =  new THREE.Mesh(GeoB3,  matB1.clone())
meshB3.position.set(550, 60, 0);
meshB3.name = 'BIM评标室'

const meshB4 =  new THREE.Mesh(GeoB4,  matB1.clone())
meshB4.name = '评标15'

meshB4.position.set(70, 60, 0);
model.add(meshB1)
model.add(meshB2).add(meshB3).add(meshB4)
 // 人
const geometry_people = new THREE.SphereGeometry( 10, 32, 16 );
const material_people = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
const mesh_people = new THREE.Mesh( geometry_people, material_people );
// model.add(mesh_people)


// 楼层
const mesh =  new THREE.Mesh(geometry, material);
mesh.position.set(680, 190, 1);
model.add(mesh)
// mesh.rotateX(-Math.PI/2);
// mesh.position.y = 2;

export default model

